package com.jxb.consumer;

import com.jxb.config.QueueDLXConfig;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
 
import java.io.UnsupportedEncodingException;
import java.util.Date;
 
@Component
@RabbitListener(queues = QueueDLXConfig.QUEUE_NAME)
public class CumMQListenerCJ {
 
    @RabbitHandler
    public void msg(@Payload Object msg) throws UnsupportedEncodingException {
        System.out.println(new Date());
        Message message = (Message) msg;
        String str = new String(message.getBody(), "utf-8");
        System.out.println(str);
    }
 
}